<%@ page contentType="text/html;charset=utf-8"  language="java" import="com.j3l11234.myy_sign.entity.UserEntity"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-01">
      <span class="sr-only">Toggle navigation</span>
    </button>
    <a class="navbar-brand" href="<c:url value="/index.do"/>">签到系统</a>
  </div>
  <div class="collapse navbar-collapse" id="navbar-collapse-01">
    <ul class="nav navbar-nav">
      <li id="navbar-item-home"><a href="<c:url value="/home/index.do"/>">个人中心</a></li>
      <li id="navbar-item-manage"><a href="<c:url value="/manage/index.do"/>">查询管理</a></li>
      <li id="navbar-item-admin"><a href="<c:url value="/admin/index.do"/>">系统设置</a></li>
    </ul>
    <ul class="nav navbar-nav navbar-right">
      <li class="dropdown">
      <%
      	String username =  "未登录";
		UserEntity userEntity = (UserEntity)(session.getAttribute("user"));
		if(userEntity != null){
			username = userEntity.getAlias();
		} 
	  %>			
        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=username%><span class="caret"></span></a>
        <ul class="dropdown-menu" role="menu">
          <li><a href="<c:url value="/user/login.do"/>">登录</a></li>
          <li><a href="<c:url value="/user/logout.do"/>">注销</a></li>
        </ul>
      </li>
    </ul>
    <div></div>

  </div><!-- /.navbar-collapse -->
</nav><!-- /navbar -->

<script>
	<%
	String navbarItem = null;
	try{
		navbarItem = (String)(request.getAttribute("navbar_item"));
		}catch(Exception e){}
	%>
	var navbarItem = document.getElementById("navbar-item-<%=navbarItem%>");
	if(navbarItem != null){
		navbarItem.className="active";
	}   
</script>
    